# Contributor: Leo <thinkabit.ukim@gmail.com>
# Maintainer: Natanael Copa <ncopa@alpinelinux.org>
pkgname=subunit
pkgver=1.3.0
pkgrel=1
pkgdesc="A streaming protocol for test results"
options="!check" # Dependencies for checking stuff are in testing/
url="https://launchpad.net/subunit"
arch="all"
license="Apache-2.0 AND BSD-3-Clause"
depends="python3 py3-extras py3-testtools"
makedepends="check-dev cppunit-dev perl-dev python3-dev automake
	autoconf libtool"
subpackages="$pkgname-dev $pkgname-libs"
source="https://launchpad.net/subunit/trunk/${pkgver%.*}/+download/subunit-$pkgver.tar.gz"
builddir="$srcdir"

prepare() {
	default_prepare
	autoreconf -fi
}

build() {
	./configure \
		--build=$CBUILD \
		--host=$CHOST \
		--prefix=/usr \
		--sysconfdir=/etc \
		--mandir=/usr/share/man \
		--infodir=/usr/share/info \
		--localstatedir=/var
	make
}

check() {
	make check
}

package() {
	make DESTDIR="$pkgdir" install
	find "$pkgdir" \( -name perllocal.pod -o -name .packlist \) -delete
	rm -f "$pkgdir"/usr/lib/*.a
	sed -i '1s|/usr/bin/env python$|/usr/bin/python3|' "$pkgdir"/usr/bin/*
}

sha512sums="7b37890546345cc481779f4bf1dc7eeca4fbda0efff1b7d7a6ca7ec574fe72e9801b7b70b8efcb0d78bb6a0a181fcdb6e49a2ff280d73f0d3dfcd1df219b2765  subunit-1.3.0.tar.gz"
